<link rel="stylesheet" type="text/css" href="./public/css/orders/info.css">
<div id="header_cart">
	<div class="center">
		<a href='./index.php'><img src="./public/images/cart_logo.png"></a>
		<div style="margin-top:20px;float:right;width:388px;height:48px;background:url(./public/images/cart_jd.png) 0 -50px" class="cart_jd"></div>
	</div>
</div>
<!-- --------------------------------------- -->
<div id='jsbody'>
	<div class='center'>
		<div class='step1'>
		<!-- ----------------------- -->
			<?php
				$_GET['tblname'] = 'shop_addr';
				$_GET['pk'] = 'uid';
				$uid = $_SESSION['userInfo']['uid'];
				if($addInfo = select(" WHERE uid=$uid")){
				echo "<div class='addrdiv'>
						<p><a class='xgsc' href='./index.php?c=orders&a=changeAdd'>修改</a> <a class='xgsc' href='./index.php?c=orders&a=deladdr'>删除</a></p>
						<ul class='addinfo'>
							<li>".$addInfo[0]['name']."</li>
							<li>".$addInfo[0]['prov'].$addInfo[0]['city'].$addInfo[0]['dist'].$addInfo[0]['addr']."</li>
							<li>&nbsp;</li>
							<li>".$addInfo[0]['tel']."</li>
						</ul>
					</div>";	 
				}else{
				echo "<p class='tit'>地址选择</p>
					  <a class='useNewAddr' href='./index.php?c=orders&a=addaddr'>+ 使用新地址</a>";
				}
				
			?>
			
		 </div>
		<!-- ----------------------- -->
		<?php
			if(isset($_SESSION['addaddr'])){
				if(empty($retAI)){
					$retAI=['name'=>'','prov'=>'','city'=>'','dist'=>'','addr'=>'','tel'=>''];
					$act='doAddAddr';
				}else{
					$act='doChangeAddr';
				}
			echo "<div class='step2'>
					<p class='tit'>收货信息管理</p>
					<div class='newadd'>
					<form action='./index.php?c=orders&a=$act' method='post'>
							<table cellspacing='20'>
								<tr>
									<td>收件人名:<i>*</i></td>
									<td colspan='3'><input required size='6' type='text' name='name' value='$retAI[name]' /></td>
								</tr>
								<tr>
									<td>收货地址:<i>*</i></td>
									<td><input required size='6' type='text' name='prov' value='$retAI[prov]' />省/直辖市</td>
									<td><input required size='6' type='text' name='city' value='$retAI[city]' />市</td>
									<td><input required size='6' type='text' name='dist' value='$retAI[dist]' />区/县</td>
								</tr>
								<tr>
									<td>详细地址:<i>*</i></td>
									<td colspan='3'><textarea required rows='5' cols='60' name='addr'>$retAI[addr]</textarea></td>
								</tr>
								<tr>
									<td>手机号码:<i>*</i></td>
									<td colspan='3'><input required type='text' name='tel' value='$retAI[tel]' /></td>
								</tr>
								<tr>
									<td></td>
									<td colspan='3'>
										<a class='no' href='./index.php?c=orders&a=ydtz'>取消</a><input class='ok' type='submit' name='' value='确定' />							
									</td>
								</tr>
							</table>
						</form>
					</div>
				</div>";
			}
		?>
		<!-- ----------------------- -->
		<div class='step3'>
			<p class='tit'>商品清单</p>
			<!-- -------------------------- -->
			<table>
				<tr>
					<th class='jmfh'>OPPO发货</th><td class='tbtit'>商品名称</td><td class='tbtit'>数量</td><td class='tbtit'>单价</td><td class='tbtit'>小计</td>
				</tr>
				<?php
					$allPri=0;
					$num=0;
					foreach($_SESSION['cart'] as $good){
					echo "<tr>
							<th><img src='./admin/public/images/goods/sm_$good[gpic]' /></th>
							<td class='tname'>$good[gname]</td>
							<td class='num'>$good[num]</td>
							<td class='dj'>$good[price]</td>
							<td class='xj'>".$good['num']*$good['price']."</td>
						  </tr>";
						$allPri += $good['price']*$good['num'];
						$num += $good['num'];
					}
					$_SESSION['endRmb'] = $allPri;
				?>
			</table>
			<!-- -------------------------- -->
		</div>
		<div class='sure'>
			<a class='back' href='./index.php?c=cart&a=index'>返回修改购物车</a>
			<table class='info' cellspacing='5'>
				<tr><td class='infotit'>共<b class='botnum'><?php echo $num;?></b>件商品,总商品金额: &nbsp; </td><td>￥<?php echo $allPri;?></td></tr>
				<tr><td class='infotit'>总运费: &nbsp; </td><td>￥0.00</td></tr>
				<tr><td class='infotit'>应付总额: &nbsp; </td><td>￥<?php echo $allPri;?></td></tr>
			</table>
			<?php
				if($addInfo && !isset($_SESSION['addaddr'])){
					echo "<a class='post' href='./index.php?c=orders&a=mkorders'>确认交易</a>";
				}else{
					unset($_SESSION['addaddr']);
					echo "<a class='dis_post'>确认交易</a>";
				}	
			?>
			<div class='allpri'>应付总额: &nbsp; <b class='price'>￥<?php echo $allPri;?></b></div>
		</div>
	</div>
</div>